{ include file='themes/pdf.tpl' }
{ include file='view/inc/firstPdf.tpl' }

<page backtop="20mm" backbottom="20mm" backleft="10mm" backright="10mm">
    <page_header>
        <h1>Produit {$data->name}</h1>
    </page_header>
    <page_footer>
        MaCrise<span style="color:red;">.com</span> - Détail de produit ({$data->name}) - page [[page_cu]] sur [[page_nb]]
    </page_footer>

    <br /><br />
    <table id="listing">
        <tbody>
            <tr>
                <td width="350px;">Date d'enregistrement</td>
                <td width="250px;">{$data->date_create|date_format:"%d/%m/%Y"}</td>
            </tr>
        </tbody>
    </table>
    <br /><br /><br />
    <table>
        <thead>
            <tr>
                <th width="350px;">Prix</th>
                <th width="250px;">Magasin</th>
            </tr>
        </thead>
        <tbody>
        { foreach from=$releves item=rel }
            <tr>
                <td>{ $rel.prix } € / { $rel.unite }</td>
                <td><a href="{$BASE_URL}stores/{ $rel.magasin->_id }-{ $rel.magasin->name|replace:' ':'-' }">{ $rel.magasin->name }</a></td>
            </tr>
        { /foreach }
        </tbody>
    </table>
    {strip}
<br /><br /><br />
    <h2>Prix</h2>
    <br />
    {assign var=last value=$releves|@end}
    <img src="https://chart.googleapis.com/chart?cht=bvg&chm=D,0033FF,1,0,5,1&chs=600x250&chd=t1:
                                { foreach from=$releves item=rel}
                                {if $last == $rel}
                                {$rel.prix}
                                {else}
                                {$rel.prix},
                                {/if}
                                {/foreach}
                               |
                               { foreach from=$releves item=rel}
                                {if $last == $rel}
                                {$medianes}
                                {else}
                                {$medianes},
                                {/if}
                                {/foreach}
                                &chxt=y" />

    {/strip}

</page>

{ include file='view/inc/lastPdf.tpl' }
